//
// Created by Joy on 2024/7/28.
//

#include <bits/stdc++.h>
#define N 15
using namespace std;

void BubbleSort(int a[],int n){
    for (int i = n - 1; i > 0; --i) {
        for (int j = 0; j < i; ++j) {
            if (a[j] > a[j+1]){
                swap(a[j],a[j+1]);
            }
        }
    }
}

int main() {
    int arr[N] = {6,3,17,100,0,12,8,7,20,78,30,-3,38,66,1};
    printf("排序前：\n");
    for (int i = 0; i < N ; ++i) {
        cout << arr[i] <<" ";
    }
    int n = sizeof(arr) / sizeof(arr[0]);
    BubbleSort(arr,n);
    printf("\n排序后:\n");
    for (int i = 0; i < N; ++i) {
        cout << arr[i] <<" ";
    }
    return 0;

    return 0;
}
